﻿namespace Sidvall.Data
{
    public sealed class DataRowItemCollection<TField> : System.Collections.ObjectModel.Collection<DataRowItem<TField>>
    {
        #region Public Members

        #region Add

        public DataRowItem<TField> Add(string key)
        {
            var item = DataRowItemManager.CreateDataRowItem<TField>(key);
            if (item == null)
                return null;
            Add(item);
            return item;
        }
        public DataRowItem<TField> Add(IDataRowContextProvider item)
        {
            return Add(item?.DataRowContextStorageKey);
        }

        #endregion

        #endregion
        #region Constructors

        public DataRowItemCollection()
        {
        }

        #endregion
    }
}
